namespace devtm.Emit
{
    using System;
    

    [Serializable]
    public class VariableDeclarationStatement : Statement
    {
        private Expression initExpression;
        private string name;
        private TypeReference type;

        public VariableDeclarationStatement()
        {
        }

        public VariableDeclarationStatement(TypeReference type, string name)
        {
            this.Type = type;
            this.Name = name;
        }


        public VariableDeclarationStatement(System.Type type, string name)
        {
            this.Type = new TypeReference(type);
            this.Name = name;
        }

        public VariableDeclarationStatement(TypeReference type, string name, Expression initExpression)
        {
            this.Type = type;
            this.Name = name;
            this.InitExpression = initExpression;
        }


        public VariableDeclarationStatement(System.Type type, string name, Expression initExpression)
        {
            this.Type = new TypeReference(type);
            this.Name = name;
            this.InitExpression = initExpression;
        }

        public Expression InitExpression
        {
            get
            {
                return this.initExpression;
            }
            set
            {
                this.initExpression = value;
            }
        }

        public string Name
        {
            get
            {
                if (this.name != null)
                {
                    return this.name;
                }
                return string.Empty;
            }
            set
            {
                this.name = value;
            }
        }

        public TypeReference Type
        {
            get
            {
                if (this.type == null)
                {
                    this.type = new TypeReference();
                }
                return this.type;
            }
            set
            {
                this.type = value;
            }
        }

        public override object Visit(Object parent, object builder)
        {
            throw new NotImplementedException();
        }
    }
}
